<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="app" >
        <div >{{count}}</div>
        <button v-on:click="increament">点击加一</button>
    </div>

    <script>
        new Vue({
            el:'#app',
            data(){
                return{
                    count:1
                }
            },
            methods:{
                increament(){
                    //count是实例上的属性,我们需要通过访问实例去获取,在methods中,this指向的就是实例,而在data中,this指向的是window
                    this.count++
                }
            }
        })
    </script>

</body>
</html>